package 语雀题目21至55.a41至55;

import java.util.Scanner;

/**
 * ClassName: 回文数
 * Package: 语雀题目21至55.a41至55
 * Description:判断一定范围内的回文数
 *
 * @Author fjorid
 * @Create 2025/1/7 20:02
 * @Version 1.0
 */
public class 回文数41{
    public static void main(String[] args) {
        int number;
        int count = 0;
        String astring;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数");
        number = scanner.nextInt();
        astring = "" + number;//直接判断数字对应位数较麻烦，根据已知知识转化成字符串容易判断对应位置。

        for (int i = 0; i < astring.length() / 2; i++) {
            if (astring.charAt(i) == astring.charAt(astring.length() - 1 - i)) {
                count++;
            }
        }
        if (count == astring.length() / 2) {
            System.out.println(number + "是回文数");
        }
    }
}
